<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel common\models\MktFeedbackSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '建议';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="mkt-feedback-index">

    <h1 style="display:none;"><?= Html::encode($this->title) ?></h1>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <p>
        <?php if (YII_DEBUG) echo Html::a('创建', ['create'], ['class' => 'btn btn-success']) ?>
    </p>
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        //'filterModel' => $searchModel,
        'columns' => [
            //['class' => 'yii\grid\SerialColumn'], 

            //'id',
            //'user_id',
            [
                'label' => 'ID',
                'attribute' => 'user_id',
                //'filter' => false,
                'headerOptions' => array('style'=>'width:60px;'),           
            ],

            [
                'label' => '头像',
                'format'=>'html',
                'value'=>function ($model, $key, $index, $column) { 

                    $headimgurl='';
                    $user = \common\models\MktUser::findOne(['id' => $model->user_id]);
                   
                    if(!empty($user))
                        $headimgurl = "<img style='width:46px' src='".$user->headimgurl."'>";

                    return $headimgurl;
                },
                 'headerOptions' => array('style'=>'width:8%;'),    
            ],

            [
                'label' => '微信昵称',
                'value'=>function ($model, $key, $index, $column) {  
                    $nickname='';
                    $user = \common\models\MktUser::findOne(['id' => $model->user_id]);
                   
                    if(!empty($user))
                        $nickname = $user->nickname;

                    return $nickname;
                    },
                'headerOptions' => array('style'=>'width:15%;'),           
            ],


            'content:ntext',
            'create_time',

            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>
</div>
